/*jslint browser:true */
// use it with a div tag
function selectText(element) {
    var doc = document, text = element, range, selection;
    if (doc.body.createTextRange) {
        //ms
        range = doc.body.createTextRange();
        range.moveToElementText(text);
        range.select();
    } else if (window.getSelection) {
        //all others
        selection = window.getSelection();
        range = doc.createRange();
        range.selectNodeContents(text);
        selection.removeAllRanges();
        selection.addRange(range);
    }
}
